package com.cy.pj.activity.dao;

import com.cy.pj.activity.pojo.Activity;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface ActivityDao {
    @Select("select * from tb_activity order by createdTime desc")
    List<Activity> findActivity();

    @Insert("insert into tb_activity (title,category,startTime,endTime,remark,state,createdUser,createdTime) values (#{title},#{category},#{startTime},#{endTime},#{remark},#{state},#{createdUser},now())")
    int insertActivity(Activity activity);

    @Update("update tb_activity set state=0 where id=#{id}")
    int updateState(Long id);
}
